package com.qf.springboot.invalidator.pojo;

import com.qf.springboot.invalidator.groups.Register;
import com.qf.springboot.invalidator.groups.Login;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    private int id;


    @NotNull(message = "名字不能为空",groups = {Register.class, Login.class})
    @Length(min=2,max = 5,message = "用户名长度不对",groups = {Register.class, Login.class})
    private String userName;
    @NotNull(message = "名字不能为空",groups = {Register.class, Login.class})
    @Length(min=2,max = 5,message = "用户名长度不对",groups = {Register.class, Login.class})
    private String password;
    @NotNull(message = "名字不能为空",groups = {Register.class})
    @Email(message = "邮箱格式错误",groups = {Register.class})
    private String email;
}
